<template>
	<view class='page_bd'>
		<view class="weui-tab">
			<view bindtap='roomdtlTap' class='room-box dp-flex-arround' data-address='undefined' data-id='undefined' data-name='调式:下次再来'  v-for="(item,index) in chatList" :key="index"  :data-viewid="item.id"  @tap="openinfo">
				<view class='left'>
					<view class="room-title">{{item.name}}</view>
					<image class='room-img' :src="item.chat" role='img'></image>
				</view>
				<view class="right">
					<image class="right-imgs" :src="item.cover" role="img"></image>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {GYZJMODEL as gyzjModel}from '../../utils/gyzjModel.js'
	export default {
		data() {
			return {
				// 群组
				chatList: '',
			}
		},
		onLoad:function(){
			uni.hideLoading();
			uni.hideToast();
			uni.hideNavigationBarLoading();
			console.log('我是userInfo',getApp().globalData.userInfo);
			// 群组
			var token = 'oCr6NKRAueUZnuoN2FoWaw%3D%3D';
			let appKey = "7d169e7365827a4e517f19bc1f9d4d3se";
			console.log('gyzjModel',gyzjModel);
			gyzjModel.prototype.getChatList(214).then(res=>{
				let normal=res.data.data;
				gyzjModel.prototype.getSeniorList('214').then(res=>{
					let news = res.data.data.concat(normal)//合并群组
					this.chatList=news;
				})
			})
			// gyzjModel._show_error('我的天');
			/*聊天室开始*/
			// uni.request({//聊天室
			// 	url: 'https://m.zxgyzj.com/room/list/'+214,
			// 	method: 'GET',
			// 	data: {},
			// 	success: res => {
			// 		var normal=res.data.data.data;
			// 		console.log('normal',normal);
			// 		uni.request({ //高级群
			// 			url: 'https://m.zxgyzj.com/group/list/'+214+"&token="+token,
			// 			method: 'GET',
			// 			data: {},
			// 			success: res => {
			// 				let news=res.data.data.data;
			// 				normal.unshift(news[0]);
			// 				this.chatList=normal;
			// 				uni.hideLoading({
			// 					title:'加载中....'
			// 				})
			// 			},
			// 			fail: () => {},
			// 			complete: () => {}
			// 		});
			// 	},
			// 	fail: () => {},
			// 	complete: () => {}
			// });
			// uni.login({
			// 	provider:'weixin',
			// 	success:function(loginRes){
			// 		console.log('loginRes',loginRes);
			// 		uni.showToast({
			// 			title:JSON.stringify(loginRes)
			// 		});
			// 		console.log(loginRes.authResult);
			// 	}
			// })
		},
		methods: {
			
		}
	}
</script>

<style>
	@import url("../../static/style/app.css");
.weui-tab {
	position: relative;
	height: 100%;
}
.room-box {
	width: 95%;
	height: 300rpx;
	border-radius: 10rpx;
	margin-left: 2.5%;
	margin-top: 20rpx;
	background: white;
	align-items: center;
}
.dp-flex-arround {
	display: flex;
	justify-content: space-around;
}
.left {
	width: 35%;
	height: 85%;
	margin-left: 20rpx;
}
.room-title {
	width: 100%;
	height: 20%;
	font-size: 30rpx;
	font-weight: 800;
	margin-left: 10rpx;
	text-overflow: ellipsis;
}
.room-img {
	width: 85%;
	height: 80%;
	margin-left: 10rpx;
}
.right {
	width: 63%;
	height: 85%;
	margin-right: 20rpx;
}
.right-imgs {
	width: 100%;
	height: 100%;
}
/*小程序page的代码*/
page{
	width: 100%;
	height: 100%;
	background-color: #efeff4;
	font-size: 16px;
	font-family: -apple-system-font, Helvetica Neue, Helvetica, sans-serif;
}

</style>
